package com.gaia.member.gaiatt.mygaia;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.gaia.member.gaiatt.R;
import com.gaia.member.gaiatt.bean.MyComplaintBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by zhangHaiTao on 2016/5/7.
 */
public class MyComplaintAllFragment extends Fragment {

    @Bind(R.id.lv_my_complaint_all)
    ListView lvMyComplaintAll;
    private Context mContext;
    private List<MyComplaintBean> complaintList = new ArrayList<>();
    private MyComplaintAllAdapter myComplaintAllAdapter;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mContext = getActivity();
        View view = View.inflate(mContext, R.layout.fragment_mygaia_my_complaint_all, null);


        ButterKnife.bind(this, view);

        for (int i=0; i<20; i++) {
            MyComplaintBean complaintBean = new MyComplaintBean();
            complaintList.add(complaintBean);
        }

        myComplaintAllAdapter = new MyComplaintAllAdapter(mContext, 0, complaintList);
        lvMyComplaintAll.setAdapter(myComplaintAllAdapter);
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }


    class MyComplaintAllAdapter extends ArrayAdapter<MyComplaintBean> {

        Context context;
        public MyComplaintAllAdapter(Context context, int resource, List<MyComplaintBean> objects) {
            super(context, resource, objects);
            this.context = context;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = View.inflate(context, R.layout.item_list_mygaia_my_complaint_all, null);
            } else {

            }

            MyComplaintBean complaintBean = getItem(position);

            return convertView;
        }
    }

}
